/**
 * 画笔对象
 */
	var PencilData = function(){
		//私有对象
		this._painterColor = false;
		this._painterLineWidth = false;
		this._painterMode = false;
		
		/**
		 * 设置画笔颜色
		 * @param {Object} data 颜色对象
		 */
		this.setPainterColor = function( data ){
            var decimal = Math.floor( Number(data.r) * 255 ) * 65536 + Math.floor(Number(data.g) * 255 ) * 256 + Math.floor(Number(data.b) * 255 );
            if(isNaN(decimal))decimal = 0;
            var num = decimal.toString(16);
            while (num.length < 6) num = "0" + num;
            this._painterColor = "#" + num;
        }
		
		/**
		 * 设置画笔粗细
		 * @param {Object} data 画笔粗细对象
		 */
		this.setPainterLineWidth = function(data){
			this._painterLineWidth = data;
		}
		
		/**
		 * 设置混合模式
		 * @param {Object} data 画笔模式对象
		 */
		this.setPainterMode = function(data){
			if(data == 16){
                this._painterMode = "erase";
            }else{
                this._painterMode = "pencil";
            }
		}
		
		
		/**
		 * 清除画笔
		 */
		this.clear = function(){
			var graphics = this.pencil.graphics;
			graphics.beginFill("#FFFFFF").drawRect(0,0,this._width,this._height);
			this._layer.updateCache("destination-out");
			graphics.clear();
		}
		
	};

	module.exports = PencilData;